package com.dishes.douguo.Controller;

import com.dishes.douguo.Service.activityService;
import com.dishes.douguo.Service.productService;
import com.dishes.douguo.util.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "商品信息管理")
@RestController
@RequestMapping("/dishes/douguo/products")
public class productController {
    @Autowired
    productService service;

    @ApiOperation("获取商品列表")
    @CrossOrigin
    @GetMapping("/getProductList")
    public AjaxResult getProductList(){


        return  AjaxResult.success(service.getProductList());
    }

    @ApiOperation("通过分类获取商品列表")
    @CrossOrigin
    @GetMapping("/getProductListBycategory")
    public AjaxResult getProductListBycategory(String category){


        return  AjaxResult.success(service.getProductListBycategory(category));
    }


}
